Column

Center of Las Vegas: 36.1699° N, 115.1398° W. Plotly displayed is surrounds this center by 0.5 degrees longitude and latitude.

restaurants %>% 
  filter(latitude > 35.6699 & latitude < 36.6699) %>% 
  filter(longitude < -114.6398 & longitude > -115.6398) %>%
  plot_ly(x = ~longitude, y = ~latitude, type = "scatter", mode = "markers",
          alpha = 0.5, 
          color = ~stars, hoverinfo = 'text',
        text = ~paste(name, " @", neighborhood, "\n", address, "\n", city, ", ", state, postal_code, "\n", stars, "stars on Yelp")) %>%
  layout(xaxis = list(title = "Longitude"),
         yaxis = list(title = "Latitude"))

Column

Creating a plotly of open and closed restaurant compared to their rating on Yelp

restaurants %>% 
  mutate(stars = if_else(stars == 1, "1",
                         if_else(stars == 1.5, "1.5",
                                 if_else(stars == 2, "2",
                                         if_else(stars == 2.5, "2.5",
                                                 if_else(stars == 3, "3",
                                                         if_else(stars == 4, "4",
                                                                 if_else(stars == 4.5, "4.5", "5"))))))),
         review_count = as.numeric(review_count)) %>% 
  group_by(stars) %>% 
  plot_ly(x = ~stars, y = ~review_count, color = ~stars, type = "bar", colors = "Set3") %>% 
  layout(xaxis = list(title = "Stars"),
         yaxis = list(title = "Number of Reviews"))

Plots of Restaurants

popular <- categories %>% 
  filter(category == "Restaurants" | category == "Food") %>% 
  distinct(business_id) %>% 
  left_join(categories, by = "business_id") %>% 
  filter(category %in% c("Bars", "Breakfast & Brunch", "Chinese", "Italian", "Mexican", "Chicken Wings", "Salad", "Sushi Bars", "Pizza", "Steakhouses", "Fast Food"))

restaurants %>% 
  select(business_id, neighborhood) %>% 
  inner_join(popular) %>% 
  distinct() %>% 
  group_by(neighborhood, category) %>% 
  tally() %>% 
  plotly::plot_ly(x = ~neighborhood, y = ~n, type = 'bar', color = ~category, hoverinfo = 'text',
        text = ~paste(neighborhood, " has ",
                      n, " ", category, " restaurants.")) %>%
  layout(yaxis = list(title = "Restaurants"), xaxis = list(title = "", tickangle = -45), barmode = 'stack')